home *** CD-ROM | disk | FTP | other *** search
/ Your Choice 1 / your choice.zip / your choice / PRGMMING / VISIONIX / VCDROMU.PAS < prev    next >
Pascal/Delphi Source File  |  1993-12-23  |  50KB  |  2,168 lines

  1. {
  2.  ════════════════════════════════════════════════════════════════════════════
  3.  
  4.  Visionix CD-ROM Audio Library (VCDROM)
  5.    Version 0.6
  6.  Copyright 1991,92,93 Visionix
  7.  ALL RIGHTS RESERVED
  8.  
  9.  ────────────────────────────────────────────────────────────────────────────
  10.  
  11.  Revision history in reverse chronological order:
  12.  
  13.  Initials  Date      Comment
  14.  ────────  ────────  ────────────────────────────────────────────────────────
  15.  
  16.  jrt       10/27/93  renamed from VCDROM to VCDROMU for beta 0.30
  17.  
  18.  rob       09/20/93  Changed code to use MSCDEX.
  19.                      Added VCD_GetNumDrives
  20.                            VCD_GetFirstDrive
  21.                            VCD_LoadMSF
  22.  
  23.  jrt       09/20/93  Changed TMSF to TFSM.
  24.  
  25.  lpg       03/15/93  Added Source Documentation
  26.  
  27.  mep       02/11/93  Cleaned up code for beta release
  28.  
  29.  jrt       02/08/93  Sync with beta 0.12 release
  30.  
  31.  jrt       12/07/92  Sync with beta 0.11 release
  32.  
  33.  jrt       11/21/92  Sync with beta 0.08
  34.  
  35.  jrt       09/15/92  First logged revision.
  36.  
  37.  ════════════════════════════════════════════════════════════════════════════
  38.  
  39.  INCOMPLETE FUNCTIONS
  40.  --------------------
  41.  
  42.    VCD_GetCaps
  43.    VCD_Close
  44.    VCD_GetDriveCaps
  45. }
  46.  
  47.  
  48. (*-
  49.  
  50. [SECTION: Section 3: Operating System Services Libraries
  51. [CHAPTER: Chapter 4: The Generic CD-ROM Unit]
  52.  
  53. [TEXT]
  54.  
  55. <Overview>
  56.  
  57. VCDROMu is a generic CD-ROM unit which currently works on MSCDEX,
  58. but which will be enhanced in the next VisionTools release to
  59. also support direct control of SCSI-2 CD-ROM drives without
  60. requiring MSCDEX.
  61.  
  62. VCDROMus is handle based.  Before you call any VCDROMu functions,
  63. you should call VCD_Open.  VCD_Open takes two paramaters: "flags"
  64. which are currently unsed, and a "method list string" which tells
  65. VCDROMu which CD-ROM methods you wish to use.  Currently, only
  66. MSCDEX is supported, so the method list string must be 'MSCDEX'.
  67.  
  68. VCD_Open will return a handle which must be used with subsequent
  69. calls to VCDROMu functions.  If the handle is NIL, the CD-ROM
  70. unit could not be opened successfully.  This is typically because
  71. the specified method (in this case, MSCDEX) is not present.
  72.  
  73. <CD-ROM Addressing types>
  74.  
  75. CD-ROM devices support two addressing types: logical block addressing
  76. and Minute/Second/Frame addressing.
  77.  
  78. Logical block addresses specify a logical block position on the CD-ROM
  79. media.  CD-ROM logical blocks are 2048 bytes in size.
  80.  
  81. Minute/Second/Frame addresses specify a minute/second/frame offset
  82. from either the beggining of the disk or the beggining of the current
  83. track.  A frame is 1/75 of a second.  A frame is also 2048 bytes in
  84. size, making a frame the same as a logical block.
  85.  
  86. <Interface>
  87.  
  88. -*)
  89.  
  90.  
  91. Unit VCDROMu;
  92.  
  93. Interface
  94.  
  95. Uses
  96.  
  97.   vmscdexu,
  98.   VTypesu,
  99.   VGenu,
  100.   DOS;
  101.  
  102. {────────────────────────────────────────────────────────────────────────────}
  103.  
  104. Const
  105.  
  106.   cCdMethodMSCDEX = 1;
  107.   cCdMethodSCSI2  = 2;
  108.  
  109. Type
  110.  
  111.   TError = WORD;
  112.  
  113.   {-----}
  114.  
  115.   TCDLibCaps = RECORD
  116.  
  117.     A : BYTE;
  118.  
  119.   END;
  120.  
  121.   PCDLibCaps = ^TCDLibCaps;
  122.  
  123.   {-----}
  124.  
  125.   TCDDriveCaps = RECORD
  126.  
  127.     Caps         : LONGINT;
  128.  
  129.   END;
  130.  
  131.   CONST
  132.  
  133.     cDoorClosed                = $001;
  134.     cDoorLocked                = $002;
  135.     cSupportsCookedAndRaw      = $004;
  136.     cSupportsWrite             = $008;
  137.     cSupportsAudio             = $010;
  138.     cSupportsISO9660           = $020;
  139.     cSupportsPrefetching       = $040;
  140.     cSupportsAudioChanMani     = $080;
  141.     cSupportsHSGAndMSF         = $100;
  142.     cReserved                  = $200;
  143.     cDiscInDrive               = $400;
  144.  
  145.  
  146. TYPE
  147.  
  148.  
  149.   PCDDriveCaps = ^TCDDriveCaps;
  150.  
  151.   {-----}
  152.  
  153.   TCDDriveInfo = RECORD
  154.  
  155.     Method        : WORD;
  156.  
  157.     MethodBus     : WORD;
  158.     MethodUnit    : WORD;
  159.  
  160.   END;
  161.  
  162.   {-----}
  163.  
  164.   TCDInstanceData = RECORD
  165.  
  166.     NumDrives : BYTE;
  167.  
  168.     DriveInfo : Array[1..8] of TCDDriveInfo;
  169.  
  170.   END;
  171.  
  172.   PCDInstanceData = ^TCDInstanceData;
  173.  
  174.   {-----}
  175.  
  176.   TCDHandle = PCDInstanceData;
  177.  
  178.   {-----}
  179.  
  180.   TCDRequestHeader = RECORD
  181.  
  182.     HeaderSize     : BYTE;
  183.     Subunit        : BYTE;
  184.     CommandCode    : BYTE;
  185.     Status         : WORD;
  186.     Reserved       : Array[1..8] of BYTE;
  187.  
  188.   END;
  189.  
  190.  
  191.  
  192. {────────────────────────────────────────────────────────────────────────────}
  193.  
  194. {----------------}
  195. { Math Functions }
  196. {----------------}
  197.  
  198. Procedure VCD_AddMSF(             Value1         : TFSM;
  199.                                   Value2         : TFSM;
  200.                               Var Result         : TFSM      );
  201.  
  202. Procedure VCD_SubMSF(             Value1         : TFSM;
  203.                                   Value2         : TFSM;
  204.                               Var Result         : TFSM      );
  205.  
  206. Function  VCD_MSFtoBlock(         MSF            : TFSM      ) : LONGINT;
  207.  
  208. Procedure VCD_BlockToMSF(         Block          : LONGINT;
  209.                               Var MSF            : TFSM      );
  210.  
  211. Function  VCD_MSFtoTotalFrames(   MSF            : TFSM      ) : LONGINT;
  212.  
  213. Procedure VCD_TotalFramesToMSF(   TotalFrames    : LONGINT;
  214.                               Var MSF            : TFSM      );
  215.  
  216. Procedure VCD_LoadMSF(        Var MSF            : TFSM;
  217.                                   M              : BYTE;
  218.                                   S              : BYTE;
  219.                                   F              : BYTE      );
  220.  
  221. Function  VCD_MSFToStr(           MSF            : TFSM      ) : STRING;
  222.  
  223.  
  224. {--------------------------}
  225. { Library/System functions }
  226. {--------------------------}
  227.  
  228. Procedure VCD_GetCaps(            Caps           : PCDLibCaps );
  229.  
  230. Function  VCD_Open(               Flags          : WORD;
  231.                                   MethodListStr  : ST80      ) : TCDHandle;
  232.  
  233. Procedure VCD_Close(              Handle         : TCDHandle );
  234.  
  235. Function  VCD_GetDriveStatus(     Handle         : TCDHandle;
  236.                                   Drive          : WORD         ) : LONGINT;
  237.  
  238. Function  VCD_GetNumDrives(       Handle         : TCDHandle ) : WORD;
  239.  
  240.  
  241. Function  VCD_GetDriveMethod(     Handle         : TCDHandle;
  242.                                   Drive          : WORD      ) : WORD;
  243.  
  244.  
  245. {--------------------}
  246. { VCD ASCII Name Get }
  247. {--------------------}
  248.  
  249. Function  VCD_GetMethodNames(     Handle         : TCDHandle;
  250.                                   Flags          : WORD        ):ST80;
  251.  
  252. Function  VCD_GetDriveName(       Handle         : TCDHandle;
  253.                                   Flags          : WORD;
  254.                                   Drive          : WORD        ):ST80;
  255.  
  256.  
  257. {--------------------}
  258. { CD Audio Functions }
  259. {--------------------}
  260.  
  261. Function  VCD_GetAudioDiskInfo(   Handle         : TCDHandle;
  262.                                   Drive          : WORD;
  263.                               Var FirstTrack     : BYTE;
  264.                               Var LastTrack      : BYTE;
  265.                               Var StartLeadOut   : TFSM      ) : TError;
  266.  
  267. Function  VCD_GetAudioTrackInfo(  Handle         : TCDHandle;
  268.                                   Drive          : WORD;
  269.                                   Track          : BYTE;
  270.                               Var Start          : TFSM;
  271.                               Var TrackConInfo   : BYTE      ) : TError;
  272.  
  273. Function  VCD_GetAudioQChanInfo(  Handle         : TCDHandle;
  274.                                   Drive          : WORD;
  275.                               Var ConAdr         : BYTE;
  276.                               Var TrackNum       : BYTE;
  277.                               Var IndexNum       : BYTE;
  278.                               Var TrkRelTime     : TFSM;
  279.                               Var DskRelTime     : TFSM      ) : TError;
  280.  
  281. Function  VCD_GetAudioStatusInfo( Handle         : TCDHandle;
  282.                                   Drive          : WORD;
  283.                               Var AudioStatus    : WORD;
  284.                               Var PlayStart      : TFSM;
  285.                               Var PlayEnd        : TFSM      ) : TError;
  286.  
  287. Function  VCD_PlayMSFfor(         Handle         : TCDHandle;
  288.                                   Drive          : WORD;
  289.                                   Start          : TFSM;
  290.                                   PlayFor        : TFSM      ) : TError;
  291.  
  292. Function  VCD_PlayMSFto(          Handle         : TCDHandle;
  293.                                   Drive          : WORD;
  294.                                   Start          : TFSM;
  295.                                   PlayTo         : TFSM      ) : TError;
  296.  
  297. Function  VCD_Pause(              Handle         : TCDHandle;
  298.                                   Drive          : WORD      ) : TError;
  299.  
  300. Function  VCD_Stop(               Handle         : TCDHandle;
  301.                                   Drive          : WORD      ) : TError;
  302.  
  303. Function  VCD_Resume(             Handle         : TCDHandle;
  304.                                   Drive          : WORD      ) : TError;
  305.  
  306.  
  307.  
  308. {---------------------------}
  309. { High-Level PLAY Functions }
  310. {---------------------------}
  311.  
  312. (*
  313. Function  VCD_PlayTracks(         Handle         : TCDHandle;
  314.                                   Drive          : WORD;
  315.                                   FirstTrack     : BYTE;
  316.                                   NumTracks      : BYTE      ) : TError;
  317. *)
  318.  
  319. Function  VCD_PlayNextTrack(      Handle         : TCDHandle;
  320.                                   Drive          : WORD       ) : TError;
  321.  
  322. Function  VCD_PlayPrevTrack(      Handle         : TCDHandle;
  323.                                   Drive          : WORD       ) : TError;
  324.  
  325.  
  326. Function  VCD_PlayForwardMSF(     Handle         : TCDHandle;
  327.                                   Drive          : WORD;
  328.                                   MoveForward    : TFSM       ) : TError;
  329.  
  330. Function  VCD_PlayReverseMSF(     Handle         : TCDHandle;
  331.                                   Drive          : WORD;
  332.                                   MoveReverse    : TFSM       ) : TError;
  333.  
  334. (*
  335. Function  VCD_PlayForwardLBA(     Handle         : TCDHandle;
  336.                                   Drive          : WORD;
  337.                                   MoveForward    : LONGINT    ) : TError;
  338.  
  339.  
  340. Function  VCD_PlayReverseLBA(     Handle         : TCDHandle;
  341.                                   Drive          : WORD;
  342.                                   MoveReverse    : LONGINT    ) : TError;
  343. *)
  344.  
  345.  
  346.  
  347.  
  348. {────────────────────────────────────────────────────────────────────────────}
  349.  
  350. Implementation
  351.  
  352. {────────────────────────────────────────────────────────────────────────────}
  353.  
  354. (*-
  355.  
  356. [FUNCTION]
  357.  
  358. Procedure VCD_AddMSF(             Value1         : TFSM;
  359.                                   Value2         : TFSM;
  360.                               Var Result         : TFSM      );
  361.  
  362. [PARAMETERS]
  363.  
  364. Value1      1st Min/Sec/Frame Value
  365. Value2      2nd Min/Sec/Frame Value
  366. Result      VAR Returned Min/Sec/Frame Sum
  367.  
  368. [RETURNS]
  369.  
  370. (Function : None)
  371. (VAR      : [Result] Min/Sec/Frame Sum)
  372.  
  373. [DESCRIPTION]
  374.  
  375. Adds the 1st Min/Sec/Frame Value to the 2nd Min/Sec/Frame Value to
  376. produce the a new Min/Sec/Frame Value.
  377.  
  378. Adds two Min/sec/frame values and puts the result in "Result".
  379.  
  380.  
  381. [SEE-ALSO]
  382.  
  383. VCD_SubMSF
  384.  
  385. [EXAMPLE]
  386.  
  387. -*)
  388.  
  389. Procedure VCD_AddMSF(             Value1         : TFSM;
  390.                                   Value2         : TFSM;
  391.                               Var Result         : TFSM      );
  392.  
  393. Var
  394.   Val1Frames : LONGINT;
  395.   Val2Frames : LONGINT;
  396.   Z          : INTEGER;
  397.  
  398. BEGIN
  399.  
  400.   Val1Frames := VCD_MSFtoTotalFrames( Value1 );
  401.   Val2Frames := VCD_MSFtoTotalFrames( Value2 );
  402.  
  403.   Inc( Val1Frames, Val2Frames );
  404.  
  405.   VCD_TotalFramesToMSF( Val1Frames, Result );
  406.  
  407. END;  { VCD_AddMSF }
  408.  
  409. {────────────────────────────────────────────────────────────────────────────}
  410.  
  411. (*-
  412.  
  413. [FUNCTION]
  414.  
  415. Procedure VCD_SubMSF(             Value1         : TFSM;
  416.                                   Value2         : TFSM;
  417.                               Var Result         : TFSM      );
  418.  
  419. [PARAMETERS]
  420.  
  421. Value1      1st Min/Sec/Frame Value
  422. Value2      2nd Min/Sec/Frame Value
  423. Result      VAR Returned Min/Sec/Frame Difference
  424.  
  425. [RETURNS]
  426.  
  427. (Function : None)
  428. (VAR      : [Result] Min/Sec/Frame Difference)
  429.  
  430. [DESCRIPTION]
  431.  
  432. Subtracts the 2nd Min/Sec/Frame Value from the 1st Min/Sec/Frame Value
  433. to produce the Difference (a new Min/Sec/Frame Value).
  434.  
  435. Subs MSF "Value2" from MSF "value1" and puts result in "Result".
  436.  
  437. [SEE-ALSO]
  438.  
  439. VCD_AddMSF
  440.  
  441. [EXAMPLE]
  442.  
  443. -*)
  444.  
  445. Procedure VCD_SubMSF(             Value1         : TFSM;
  446.                                   Value2         : TFSM;
  447.                               Var Result         : TFSM      );
  448.  
  449. Var
  450.   Val1Frames : LONGINT;
  451.   Val2Frames : LONGINT;
  452.   Z          : INTEGER;
  453.  
  454. BEGIN
  455.  
  456.   Val1Frames := VCD_MSFtoTotalFrames( Value1 );
  457.   Val2Frames := VCD_MSFtoTotalFrames( Value2 );
  458.  
  459.   Dec( Val1Frames, Val2Frames );
  460.  
  461.   VCD_TotalFramesToMSF( Val1Frames, Result );
  462.  
  463. END;  { VCD_SubMSF }
  464.  
  465. {────────────────────────────────────────────────────────────────────────────}
  466.  
  467. (*-
  468.  
  469. [FUNCTION]
  470.  
  471. Function  VCD_MSFtoBlock(         MSF            : TFSM      ) : LONGINT;
  472.  
  473. [PARAMETERS]
  474.  
  475. MSF         Source Min/Sec/Frames Value
  476.  
  477. [RETURNS]
  478.  
  479. Total Blocks represented by Min/Sec/Frame Value.
  480.  
  481. [DESCRIPTION]
  482.  
  483. Converts a min/sec/frame address to a logical block address.
  484.  
  485. [SEE-ALSO]
  486.  
  487.  
  488. [EXAMPLE]
  489.  
  490. -*)
  491.  
  492. Function  VCD_MSFtoBlock(         MSF            : TFSM      ) : LONGINT;
  493.  
  494. BEGIN
  495.  
  496.   VCD_MSFToBlock := (  ( Longint(MSF.M) * 4500 ) +
  497.                        ( Longint(MSF.S) * 75   ) +
  498.                        ( Longint(MSF.F)        )   ) - 150;
  499.  
  500. END;  { VCD_MSFtoBlock }
  501.  
  502. {────────────────────────────────────────────────────────────────────────────}
  503.  
  504. (*-
  505.  
  506. [FUNCTION]
  507.  
  508. Procedure VCD_BlockToMSF(         Block          : LONGINT;
  509.                               Var MSF            : TFSM      );
  510.  
  511. [PARAMETERS]
  512.  
  513. Block       Source Number of Blocks
  514. MSF         VAR Returned Min/Sec/Frame Value
  515.  
  516. [RETURNS]
  517.  
  518. (Function : None)
  519. (VAR      : [MSF] Min/Sec/Frame Value)
  520.  
  521. [DESCRIPTION]
  522.  
  523. Converts a Logical Block Address to a Min/Sec/Frame Address.
  524.  
  525. [SEE-ALSO]
  526.  
  527. VCD_MSFtoBlock
  528.  
  529. [EXAMPLE]
  530.  
  531. -*)
  532.  
  533. Procedure VCD_BlockToMSF(         Block          : LONGINT;
  534.                               Var MSF            : TFSM      );
  535.  
  536. BEGIN
  537.  
  538.   MSF.M := ( (Block+150) DIV 4500 );
  539.   MSF.S := ( (Block+150) MOD 4500 ) DIV 60;
  540.   MSF.F := ( (Block+150) MOD 60   );
  541.  
  542. END;  { VCD_BlockToMSF }
  543.  
  544. {────────────────────────────────────────────────────────────────────────────}
  545.  
  546. (*-
  547.  
  548. [FUNCTION]
  549.  
  550. Function  VCD_MSFtoTotalFrames(   MSF            : TFSM      ) : LONGINT;
  551.  
  552. [PARAMETERS]
  553.  
  554. MSF         Min/Sec/Frame Value
  555.  
  556. [RETURNS]
  557.  
  558. Total Frames from Min/Sec/Frames Value
  559.  
  560. [DESCRIPTION]
  561.  
  562. Converts a Min/Sec/Frames Value into the Total Number of Frames it
  563. represents.
  564.  
  565. Converts a min/sec/frame value to a count of the total frames.
  566.  
  567. [SEE-ALSO]
  568.  
  569. VCD_TotalFramesToMSF
  570.  
  571. [EXAMPLE]
  572.  
  573. -*)
  574.  
  575. Function  VCD_MSFtoTotalFrames(   MSF            : TFSM      ) : LONGINT;
  576.  
  577. BEGIN
  578.  
  579.   VCD_MSFToTotalFrames := ( Longint(MSF.M) * 4500 ) +
  580.                           ( Longint(MSF.S) * 75   ) +
  581.                           ( Longint(MSF.F)        );
  582.  
  583. END;  { VCD_MSFtoTotalFrames }
  584.  
  585. {────────────────────────────────────────────────────────────────────────────}
  586.  
  587. (*-
  588.  
  589. [FUNCTION]
  590.  
  591. Procedure VCD_TotalFramesToMSF(   TotalFrames    : LONGINT;
  592.                               Var MSF            : TFSM      );
  593.  
  594. [PARAMETERS]
  595.  
  596. TotalFrames
  597. MSF         VAR Returned Frames converted to Min/Sec/Frames
  598.  
  599. [RETURNS]
  600.  
  601. (Function : None)
  602. (VAR      : [MSF] Frame converted to Min/Sec/Frames)
  603.  
  604. [DESCRIPTION]
  605.  
  606. Converts a Frames Value into Min/Sec/Frames.
  607.  
  608. Converts a total frames value to a min/sec/frame value.
  609.  
  610. [SEE-ALSO]
  611.  
  612. VCD_MSFtoTotalFrames
  613.  
  614. [EXAMPLE]
  615.  
  616. -*)
  617.  
  618. Procedure VCD_TotalFramesToMSF(   TotalFrames    : LONGINT;
  619.                               Var MSF            : TFSM      );
  620.  
  621. BEGIN
  622.  
  623.   MSF.M := (TotalFrames DIV 4500);
  624.   MSF.S := (TotalFrames MOD 4500) DIV 75;
  625.   MSF.F := (TotalFrames MOD 75);
  626.  
  627. END;  { VCD_TotalFramesToMSF }
  628.  
  629. {────────────────────────────────────────────────────────────────────────────}
  630.  
  631. (*-
  632.  
  633. [FUNCTION]
  634.  
  635. Procedure VCD_LoadMSF(        Var MSF            : TFSM;
  636.                                   M              : BYTE;
  637.                                   S              : BYTE;
  638.                                   F              : BYTE      );
  639.  
  640. [PARAMETERS]
  641.  
  642. MSF         VAR Returned Min/Sec/Frame Value
  643. M           Source Minutes
  644. S           Source Seconds
  645. F           Source Frames
  646.  
  647. [RETURNS]
  648.  
  649. (Function : None)
  650. (VAR      : [MSF] Min/Sec/Frame Value)
  651.  
  652. [DESCRIPTION]
  653.  
  654. Converts time Values into Min/Sec/Frames
  655.  
  656. Loads a min/sec/frame record with values.
  657.  
  658. [SEE-ALSO]
  659.  
  660. [EXAMPLE]
  661.  
  662. -*)
  663.  
  664. Procedure VCD_LoadMSF(        Var MSF            : TFSM;
  665.                                   M              : BYTE;
  666.                                   S              : BYTE;
  667.                                   F              : BYTE      );
  668.  
  669. BEGIN
  670.  
  671.    MSF.M := M;
  672.    MSF.S := S;
  673.    MSF.F := F;
  674.    MSF.P := 0;
  675.  
  676. END;  { VCD_LoadMSF }
  677.  
  678. {────────────────────────────────────────────────────────────────────────────}
  679.  
  680.  
  681. (*-
  682.  
  683. [FUNCTION]
  684.  
  685. [PARAMETERS]
  686.  
  687. MSF       min/sec/frame to convert to a string
  688.  
  689. [RETURNS]
  690.  
  691. string representation of the MSF in the form m:s.f
  692.  
  693. [DESCRIPTION]
  694.  
  695. Converts a min/sec/frame record into at string.
  696.  
  697. [SEE-ALSO]
  698.  
  699. [EXAMPLE]
  700.  
  701. -*)
  702.  
  703. Function  VCD_MSFToStr(           MSF            : TFSM      ) : STRING;
  704.  
  705. BEGIN
  706.  
  707.   VCD_MSFToStr := IntToStr(MSF.M) + ':' +
  708.                   IntToStr(MSF.S) + '.' +
  709.                   IntToStr(MSF.F);
  710.  
  711. END;
  712.  
  713. {────────────────────────────────────────────────────────────────────────────}
  714.  
  715. (*-
  716.  
  717. [FUNCTION]
  718.  
  719. Procedure VCD_GetCaps(            Caps           : PCDLibCaps );
  720.  
  721. [PARAMETERS]
  722.  
  723. Caps        Pointer to ?
  724.  
  725. [RETURNS]
  726.  
  727. (Function : None)
  728. (Ptr      : [Caps] Pointer to ?)
  729.  
  730. [DESCRIPTION]
  731.  
  732. Gets the capabilities of the CD-rom lib in the current environment.
  733.  
  734. [SEE-ALSO]
  735.  
  736. [EXAMPLE]
  737.  
  738. -*)
  739.  
  740. Procedure VCD_GetCaps(            Caps           : PCDLibCaps );
  741.  
  742. BEGIN
  743.  
  744. END;  { VCD_GetCaps }
  745.  
  746. {────────────────────────────────────────────────────────────────────────────}
  747.  
  748. (*-
  749.  
  750. [FUNCTION]
  751.  
  752. Function  VCD_CheckForMethod(     Method         : BYTE      ) : BOOLEAN;
  753.  
  754. [PARAMETERS]
  755.  
  756. Method      ?
  757.  
  758. [RETURNS]
  759.  
  760. [DESCRIPTION]
  761.  
  762. [SEE-ALSO]
  763.  
  764. [EXAMPLE]
  765.  
  766. -*)
  767.  
  768. Function  VCD_CheckForMethod(     Method         : BYTE      ) : BOOLEAN;
  769. Var
  770.    MSCDEXVerNumber   : Word;
  771.  
  772. BEGIN
  773.  
  774.    Case Method of
  775.       ccdmethodMSCDEX :
  776.       Begin
  777.          asm
  778.             mov bx,0
  779.             mov ax,$150c
  780.             int $2f
  781.             mov MSCDEXVerNumber,bx
  782.          end;
  783.          If MSCDEXVerNumber < $200 then
  784.             VCD_CheckForMethod := False
  785.          Else
  786.             VCD_CheckForMethod := True;
  787.  
  788.       End;
  789.       ccdMethodSCSI2  : VCD_CheckForMethod := False;  {not supported }
  790.    else
  791.       VCD_CheckForMethod := False;
  792.    End;
  793.  
  794. END;  { VCD_CheckForMethod }
  795.  
  796. {────────────────────────────────────────────────────────────────────────────}
  797.  
  798. (*-
  799.  
  800. [FUNCTION]
  801.  
  802. Function  VCD_Open(               Flags          : WORD;
  803.                                   MethodListStr  : ST80      ) : TCDHandle;
  804.  
  805. [PARAMETERS]
  806.  
  807. Flags         ?
  808. MethodListStr ?
  809.  
  810. [RETURNS]
  811.  
  812. [DESCRIPTION]
  813.  
  814. Opens an instance of the cd-rom library.  "MethodListStr" should
  815. currently be 'MSCDEX'.  "Flags" should be 0.  Returns a Non-0 (NIL)
  816. handle if successfull, 0/NIL if failure.
  817.  
  818. [SEE-ALSO]
  819.  
  820. [EXAMPLE]
  821.  
  822. -*)
  823.  
  824. Function  VCD_Open(               Flags          : WORD;
  825.                                   MethodListStr  : ST80      ) : TCDHandle;
  826.  
  827. Var
  828.   Method  : BYTE;
  829.   NCDI    : PCDInstanceData;
  830.  
  831.  
  832.   {───────────────────────────────────────────────────────────────────────}
  833.  
  834.   Function GetNextMethod : BYTE;
  835.  
  836.   Var
  837.     NMLen     : BYTE;
  838.     MethodStr : STRING;
  839.  
  840.   BEGIN
  841.  
  842.     {------------------------}
  843.     { Get next method string }
  844.     {------------------------}
  845.  
  846.     NMLen := Pos( ',', MethodListStr );
  847.  
  848.     If NMLen <> 0 Then
  849.     BEGIN
  850.  
  851.       MethodStr := Copy( MethodListStr, 1, NMLen-1 );
  852.       Delete( MethodListStr, 1, NMLen );
  853.  
  854.     END  { If NMLen }
  855.  
  856.     ELSE
  857.     BEGIN
  858.  
  859.       MethodStr     := MethodListStr;
  860.       MethodListStr := '';
  861.  
  862.     END;  { If NMLen / Else }
  863.  
  864.     {--------------------------}
  865.     { Convert Method into byte }
  866.     {--------------------------}
  867.  
  868.     If MethodStr='' Then
  869.       GetNextMethod := $FF
  870.  
  871.     Else
  872.     If MethodStr='MSCDEX' Then
  873.       GetNextMethod := cCDmethodMSCDEX
  874.  
  875.     Else
  876.     If MethodStr='SCSI-2' Then
  877.       GetNextMethod := cCDmethodSCSI2
  878.  
  879.     Else
  880.       GetNextMethod := $FE;
  881.  
  882.   END; { GetNextMethod }
  883.  
  884.   {───────────────────────────────────────────────────────────────────────}
  885.  
  886. BEGIN
  887.  
  888.   {----------------------------------}
  889.   { Loop through method string until }
  890.   { the end, an error, or we find    }
  891.   { a valid method.                  }
  892.   {----------------------------------}
  893.  
  894.   Repeat
  895.  
  896.     Method := GetNextMethod;
  897.  
  898.   Until ( Method=$FF                         ) or
  899.         ( Method=$FE                         ) or
  900.         ( VCD_CheckForMethod( Method )=TRUE  );
  901.  
  902.   {-------------------}
  903.   { Was it an error ? }
  904.   {-------------------}
  905.  
  906.   If (Method=$FF) or (Method=$FE) Then
  907.   BEGIN
  908.  
  909.     VCD_Open := NIL;
  910.  
  911.   END  { If Method }
  912.  
  913.   ELSE
  914.   BEGIN
  915.  
  916.     {----------------------------}
  917.     { No error.  We have found a }
  918.     { valid method.              }
  919.     {----------------------------}
  920.  
  921.     New( NCDI );
  922.  
  923.     NCDI^.NumDrives := 0;
  924.  
  925.     Case Method Of
  926.  
  927.       {----}
  928.  
  929.       cCDmethodMSCDEX:
  930.       BEGIN
  931.  
  932.          NCDI^.NumDrives := NCDI^.NumDrives + Lo(MSCDEX_GetNumDrives);
  933.  
  934.          NCDI^.DriveInfo[1].MethodUnit := MSCDEX_GetFirstDrive;
  935.          NCDI^.DriveInfo[1].Method     := ccdMethodMSCDEX;
  936.          NCDI^.DriveInfo[1].MethodBus  := 0;
  937.  
  938.       END;  { cCDMethodMSCDEX }
  939.  
  940.       {----}
  941.  
  942.       cCDMethodSCSI2:
  943.       BEGIN
  944.  
  945.       END;  { cCDMethodSCSI2 }
  946.  
  947.       {----}
  948.  
  949.     END; { Case Method }
  950.  
  951.     VCD_Open := NCDI;
  952.  
  953.   END; { If Method / Else }
  954.  
  955. END; { VCD_Open }
  956.  
  957. {────────────────────────────────────────────────────────────────────────────}
  958.  
  959. (*-
  960.  
  961. [FUNCTION]
  962.  
  963. Procedure VCD_Close(              Handle         : TCDHandle );
  964.  
  965. [PARAMETERS]
  966.  
  967. Handle      ?
  968.  
  969. [RETURNS]
  970.  
  971. (None)
  972.  
  973. [DESCRIPTION]
  974.  
  975. Closes an instance of the cd-rom library.  The "Handle" should be a
  976. handle previously obtained from a call to VCD_Open.
  977.  
  978. [SEE-ALSO]
  979.  
  980. [EXAMPLE]
  981.  
  982. -*)
  983.  
  984. Procedure VCD_Close(              Handle         : TCDHandle );
  985.  
  986. BEGIN
  987.  
  988.    If Handle <> NIL Then
  989.       Dispose( Handle );
  990.  
  991. END;  { VCD_Close }
  992.  
  993. {────────────────────────────────────────────────────────────────────────────}
  994.  
  995. (*-
  996.  
  997. [FUNCTION]
  998.  
  999. Procedure VCD_GetDriveCaps(       Handle         : TCDHandle;
  1000.                                   Drive          : WORD;
  1001.                                   CDDriveCaps    : PCDDriveCaps );
  1002.  
  1003. [PARAMETERS]
  1004.  
  1005. Handle      ?
  1006. Drive       CD-ROM Drive Number
  1007. CDDriveCaps Pointer to CD-ROM Drive Capacity Data
  1008.  
  1009. [RETURNS]
  1010.  
  1011. (Function : None)
  1012. (Ptr      : [CDDriveCaps] Pointer to CD-ROM Drive Capacity Data)
  1013.  
  1014. [DESCRIPTION]
  1015.  
  1016. Gets the capabilities of a specific cd-rom drive.
  1017.  
  1018. [SEE-ALSO]
  1019.  
  1020. [EXAMPLE]
  1021.  
  1022. -*)
  1023.  
  1024. Function  VCD_GetDriveStatus(     Handle         : TCDHandle;
  1025.                                   Drive          : WORD         ) : LONGINT;
  1026.  
  1027. Var
  1028.  
  1029.   Err    : TError;
  1030.   Status : LONGINT;
  1031.  
  1032. BEGIN
  1033.  
  1034.  
  1035.   Case Handle^.DriveInfo[Drive].Method Of
  1036.  
  1037.     {----}
  1038.  
  1039.     cCDMethodMSCDEX:
  1040.     BEGIN
  1041.  
  1042.       Status := 0;
  1043.  
  1044.       Err := MSCDEX_GetDevStatus( Handle^.DriveInfo[Drive].MethodUnit,
  1045.                                   Status                                 );
  1046.  
  1047.       VCD_GetDriveStatus := Status;
  1048.  
  1049.     END;  { cCDMethodMSCDEX: }
  1050.  
  1051.     {----}
  1052.  
  1053.   END; { Case Handle^.DriveInfo[Drive].Method }
  1054.  
  1055. END;  { VCD_GetDriveStatus }
  1056.  
  1057. {────────────────────────────────────────────────────────────────────────────}
  1058.  
  1059. (*-
  1060.  
  1061. [FUNCTION]
  1062.  
  1063. Function  VCD_GetNumDrives(       Handle         : TCDHandle ) : WORD;
  1064.  
  1065. [PARAMETERS]
  1066.  
  1067. Handle      ?
  1068.  
  1069. [RETURNS]
  1070.  
  1071. [DESCRIPTION]
  1072.  
  1073. Returns the number of CD-rom drives installed in the system "Handle"
  1074. should be a handle previously obtained from VCD_Open.
  1075.  
  1076. [SEE-ALSO]
  1077.  
  1078. [EXAMPLE]
  1079.  
  1080. -*)
  1081.  
  1082. Function  VCD_GetNumDrives(       Handle         : TCDHandle ) : WORD;
  1083.  
  1084. BEGIN
  1085.  
  1086.    VCD_GetNumDrives := Handle^.NumDrives;
  1087.  
  1088. END;  { VCD_GetNumDrives }
  1089.  
  1090. {────────────────────────────────────────────────────────────────────────────}
  1091.  
  1092. (*-
  1093.  
  1094. [FUNCTION]
  1095.  
  1096. Function  VCD_GetDriveMethod(     Handle         : TCDHandle;
  1097.                                   Drive          : WORD      ) : WORD;
  1098.  
  1099. [PARAMETERS]
  1100.  
  1101. Handle      ?
  1102.  
  1103. [RETURNS]
  1104.  
  1105. [DESCRIPTION]
  1106.  
  1107. Returns the method that is used by the specified drive.
  1108.  
  1109. [SEE-ALSO]
  1110.  
  1111. [EXAMPLE]
  1112.  
  1113. -*)
  1114.  
  1115. Function  VCD_GetDriveMethod(     Handle         : TCDHandle;
  1116.                                   Drive          : WORD      ) : WORD;
  1117.  
  1118. BEGIN
  1119.  
  1120.   VCD_GetDriveMethod := Handle^.DriveInfo[Drive].Method;
  1121.  
  1122. END;  { VCD_GetFirstDrive }
  1123.  
  1124. {────────────────────────────────────────────────────────────────────────────}
  1125.  
  1126. (*-
  1127.  
  1128. [FUNCTION]
  1129.  
  1130. Function  VCD_GetMethodNames(     Handle         : TCDHandle;
  1131.                                   Flags          : WORD        ):ST80;
  1132.  
  1133. [PARAMETERS]
  1134.  
  1135. Handle      ?
  1136.  
  1137. [RETURNS]
  1138.  
  1139. [DESCRIPTION]
  1140.  
  1141.  
  1142. [SEE-ALSO]
  1143.  
  1144. [EXAMPLE]
  1145.  
  1146. -*)
  1147.  
  1148.  
  1149. Function  VCD_GetMethodNames(     Handle         : TCDHandle;
  1150.                                   Flags          : WORD        ):ST80;
  1151.  
  1152. VAR
  1153.    S      : ST80;
  1154.    Z      : WORD;
  1155.  
  1156. BEGIN
  1157.  
  1158.   FOR Z := 1 to Handle^.NumDrives Do
  1159.  
  1160.     Case Handle^.DriveInfo[Z].Method Of
  1161.  
  1162.       cCDMethodMSCDEX:
  1163.       BEGIN
  1164.  
  1165.          {If it isn't already in list add it }
  1166.  
  1167.          If Pos ( 'MSCDEX', S ) = 0 then
  1168.             S := S + 'MSCDEX';
  1169.  
  1170.       END;  { cCDMethodMSCDEX: }
  1171.  
  1172.       cCDMEthodSCSI2:
  1173.       BEGIN
  1174.          IF Pos ( 'SCSI-2', S ) = 0 Then
  1175.             S := S + 'SCSI-2';
  1176.  
  1177.       END;  { cCDMethodSCSI2 }
  1178.  
  1179.     END; { Case Handle^.DriveInfo[Drive].Method }
  1180.  
  1181. END;
  1182.  
  1183. {────────────────────────────────────────────────────────────────────────────}
  1184.  
  1185. (*-
  1186.  
  1187. [FUNCTION]
  1188.  
  1189. Function  VCD_GetDriveName(       Handle         : TCDHandle;
  1190.                                   Flags          : WORD;
  1191.                                   Drive          : WORD        ):ST80;
  1192.  
  1193. [PARAMETERS]
  1194.  
  1195. Handle      ?
  1196.  
  1197. [RETURNS]
  1198.  
  1199. [DESCRIPTION]
  1200.  
  1201.  
  1202. [SEE-ALSO]
  1203.  
  1204. [EXAMPLE]
  1205.  
  1206. -*)
  1207.  
  1208.  
  1209. Function  VCD_GetDriveName(       Handle         : TCDHandle;
  1210.                                   Flags          : WORD;
  1211.                                   Drive          : WORD        ):ST80;
  1212.  
  1213.  
  1214. BEGIN
  1215.  
  1216.   Case Handle^.DriveInfo[Drive].Method Of
  1217.  
  1218.     {----}
  1219.  
  1220.     cCDMethodMSCDEX:
  1221.     BEGIN
  1222.  
  1223.        VCD_GetDriveName := 'UnDetermined';
  1224.  
  1225.     END;  { cCDMethodMSCDEX: }
  1226.  
  1227.     cCDMEthodSCSI2:
  1228.     BEGIN
  1229.  
  1230.     END;  { cCDMethodSCSI2 }
  1231.  
  1232.     {----}
  1233.  
  1234.   END; { Case Handle^.DriveInfo[Drive].Method }
  1235.  
  1236. END;
  1237.  
  1238. {────────────────────────────────────────────────────────────────────────────}
  1239.  
  1240. (*-
  1241.  
  1242. [FUNCTION]
  1243.  
  1244. Function  VCD_GetAudioDiskInfo(   Handle         : TCDHandle;
  1245.                                   Drive          : WORD;
  1246.                               Var FirstTrack     : WORD;
  1247.                               Var LastTrack      : WORD;
  1248.                               Var StartLeadOut   : TFSM      ) : TError;
  1249.  
  1250. [PARAMETERS]
  1251.  
  1252. Handle      ?
  1253. Drive       CD-ROM Drive Number
  1254. FirstTrack   VAR Returned First Track Number
  1255. LastTrack    VAR Returned Last Track Number
  1256. StartLeadOut VAR Returned Starting Lead Out Time
  1257.  
  1258. [RETURNS]
  1259.  
  1260. (Function : Status Code)
  1261. (VAR      : [FirstTrack] First Track Number)
  1262. (VAR      : [LastTrack] Last Track Number)
  1263. (VAR      : [StartLeadOut] Starting Lead Out Time)
  1264.  
  1265. [DESCRIPTION]
  1266.  
  1267. Gets a audio cd's disk information.  Includes information on the first
  1268. and last audio track on the disk, and the start of the lead out track
  1269. (end of the audio) as a min/sec/frame value.
  1270.  
  1271. [SEE-ALSO]
  1272.  
  1273. [EXAMPLE]
  1274.  
  1275. -*)
  1276.  
  1277. Function  VCD_GetAudioDiskInfo(   Handle         : TCDHandle;
  1278.                                   Drive          : WORD;
  1279.                               Var FirstTrack     : BYTE;
  1280.                               Var LastTrack      : BYTE;
  1281.                               Var StartLeadOut   : TFSM      ) : TError;
  1282.  
  1283. BEGIN
  1284.  
  1285.   Case Handle^.DriveInfo[Drive].Method Of
  1286.  
  1287.     {----}
  1288.  
  1289.     cCDMethodMSCDEX:
  1290.     BEGIN
  1291.  
  1292.       VCD_GetAudioDiskInfo :=
  1293.  
  1294.               MSCDEX_GetAudioDIskInfo( Handle^.DriveInfo[Drive].MethodUnit,
  1295.                                        FirstTrack,
  1296.                                        LastTrack,
  1297.                                        Longint(StartLeadOut)              );
  1298.  
  1299.  
  1300.     END;  { cCDMethodMSCDEX: }
  1301.  
  1302.     {----}
  1303.  
  1304.   END; { Case Handle^.DriveInfo[Drive].Method }
  1305.  
  1306. END; { VCD_GetAudioDiskInfo }
  1307.  
  1308. {────────────────────────────────────────────────────────────────────────────}
  1309.  
  1310. (*-
  1311.  
  1312. [FUNCTION]
  1313.  
  1314. Function  VCD_GetAudioTrackInfo(  Handle         : TCDHandle;
  1315.                                   Drive          : WORD;
  1316.                                   Track          : WORD;
  1317.                               Var Start          : TFSM;
  1318.                               Var TrackConInfo   : WORD      ) : TError;
  1319.  
  1320. [PARAMETERS]
  1321.  
  1322. Handle       ?
  1323. Drive        CD-ROM Drive Number
  1324. Track        ?
  1325. Start        VAR Returned Starting Time
  1326. TrackConInfo VAR Returned ?
  1327.  
  1328. [RETURNS]
  1329.  
  1330. (Function : Status Code)
  1331. (VAR      : [Start] Starting Time)
  1332. (VAR      : [TrackConInfo] ?)
  1333.  
  1334. [DESCRIPTION]
  1335.  
  1336. Gets information about an audio track on a cd.  "track" is the track
  1337. number to get the information about.  "Start" returns as the Min/sec/frame
  1338. start time of the track.  "TrackConInfo" are the track control info flags.
  1339.  
  1340. [SEE-ALSO]
  1341.  
  1342. [EXAMPLE]
  1343.  
  1344. -*)
  1345.  
  1346. Function  VCD_GetAudioTrackInfo(  Handle         : TCDHandle;
  1347.                                   Drive          : WORD;
  1348.                                   Track          : BYTE;
  1349.                               Var Start          : TFSM;
  1350.                               Var TrackConInfo   : BYTE      ) : TError;
  1351.  
  1352. BEGIN
  1353.  
  1354.   Case Handle^.DriveInfo[Drive].Method Of
  1355.  
  1356.     {----}
  1357.  
  1358.     cCDMethodMSCDEX:
  1359.     BEGIN
  1360.  
  1361.       VCD_GetAudioTrackInfo := MSCDEX_GetAudioTrackInfo (
  1362.                                 Handle^.DriveInfo[Drive].MethodUnit,
  1363.                                 Track,
  1364.                                 Longint(Start),
  1365.                                 TrackConInfo                         );
  1366.  
  1367.     END; { cCDMethodMSCDEX }
  1368.  
  1369.     {----}
  1370.  
  1371.   END; { Case Handle^.DriveInfo[Drive].Method }
  1372.  
  1373. END; { VCD_GetAudioTrackInfo }
  1374.  
  1375. {────────────────────────────────────────────────────────────────────────────}
  1376.  
  1377. (*-
  1378.  
  1379. [FUNCTION]
  1380.  
  1381. Function  VCD_GetAudioQChanInfo(  Handle         : TCDHandle;
  1382.                                   Drive          : WORD;
  1383.                               Var ConAdr         : WORD;
  1384.                               Var TrackNum       : WORD;
  1385.                               Var IndexNum       : WORD;
  1386.                               Var TrkRelTime     : TFSM;
  1387.                               Var DskRelTime     : TFSM      ) : TError;
  1388.  
  1389. [PARAMETERS]
  1390.  
  1391. Handle      ?
  1392. Drive       CD-ROM Drive Number
  1393. ConAdr      VAR Returned ?
  1394. TrackNum    VAR Returned Current Track Number
  1395. IndexNum    VAR Returned Current Index Number
  1396. TrkRelTime  VAR Returned Current Track Relative Time
  1397. DskRelTime  VAR Returned Current Disk Relative Time
  1398.  
  1399. [RETURNS]
  1400.  
  1401. (Function : Status Code)
  1402. (VAR      : [ConAdr] ?)
  1403. (VAR      : [TrackNum] Current Track Number)
  1404. (VAR      : [IndexNum] Current Index Number)
  1405. (VAR      : [TrkRelTime] Current Track Relative Time)
  1406. (VAR      : [DskRelTime] Current Disk Relative Time)
  1407.  
  1408. [DESCRIPTION]
  1409.  
  1410. Gets an audio tracks "Q-Channel" information from the currently playing
  1411. track.  The Q-Channel contains information about the currently playing
  1412. audio track.  The returned info includes "ConAdr" (not used), "TrackNum",
  1413. the track number that is currently being played; "IndexNum" the index
  1414. within the track that is being played; "TrkRelTime", the current
  1415. min/sec/frame being played, relative to the start of the track; and
  1416. "DskRelTime" which is the current min/sec/frame being played relative
  1417. to the start of the disk.
  1418.  
  1419. [SEE-ALSO]
  1420.  
  1421. [EXAMPLE]
  1422.  
  1423. -*)
  1424.  
  1425. Function  VCD_GetAudioQChanInfo(  Handle         : TCDHandle;
  1426.                                   Drive          : WORD;
  1427.                               Var ConAdr         : BYTE;
  1428.                               Var TrackNum       : BYTE;
  1429.                               Var IndexNum       : BYTE;
  1430.                               Var TrkRelTime     : TFSM;
  1431.                               Var DskRelTime     : TFSM      ) : TError;
  1432.  
  1433. BEGIN
  1434.  
  1435.   Case Handle^.DriveInfo[Drive].Method Of
  1436.  
  1437.     {----}
  1438.  
  1439.     cCDMethodMSCDEX:
  1440.     BEGIN
  1441.  
  1442.        VCD_GetAudioQChanInfo := MSCDEX_GetAudioQChanInfo (
  1443.                                    Handle^.DriveInfo[Drive].MethodUnit,
  1444.                                    ConAdr,
  1445.                                    TrackNum,
  1446.                                    IndexNum,
  1447.                                    TrkRelTime,
  1448.                                    DskRelTime                          );
  1449.  
  1450.  
  1451.     END; { cCDMethodMSCDEX }
  1452.  
  1453.     {----}
  1454.  
  1455.   END; { Case Handle^.DriveInfo[Drive].Method }
  1456.  
  1457. END;  { VCD_GetAudioQChanInfo }
  1458.  
  1459. {────────────────────────────────────────────────────────────────────────────}
  1460.  
  1461. (*-
  1462.  
  1463. [FUNCTION]
  1464.  
  1465. Function  VCD_GetAudioStatusInfo( Handle         : TCDHandle;
  1466.                                   Drive          : WORD;
  1467.                               Var AudioStatus    : WORD;
  1468.                               Var PlayStart      : TFSM;
  1469.                               Var PlayEnd        : TFSM      ) : TError;
  1470.  
  1471. [PARAMETERS]
  1472.  
  1473. Handle      ?
  1474. Drive       CD-ROM Drive Number
  1475. AudioStatus VAR Returned CD-ROM Audio Status Code
  1476. PlayStart   VAR Returned Last Play Start Time
  1477. PlayEnd     VAR Returned Last Play End Time
  1478.  
  1479. [RETURNS]
  1480.  
  1481. (Function : Status Code)
  1482. (VAR      : [AudioStatus] CD-ROM Audio Status Code)
  1483. (VAR      : [PlayStart] Last Play Start Time)
  1484. (VAR      : [PlayEnd] Last Play End Time)
  1485.  
  1486. [DESCRIPTION]
  1487.  
  1488. Gets information about the currently "audio play".  This info includes
  1489. "AudioStatus" (TBD), "PlayStart", the min/sec/frame at which the current
  1490. audio play operation started, and PlayEnd, the min/sec/frame at which
  1491. the audio play operation will end.                              }
  1492.  
  1493. [SEE-ALSO]
  1494.  
  1495. [EXAMPLE]
  1496.  
  1497. -*)
  1498.  
  1499. Function  VCD_GetAudioStatusInfo( Handle         : TCDHandle;
  1500.                                   Drive          : WORD;
  1501.                               Var AudioStatus    : WORD;
  1502.                               Var PlayStart      : TFSM;
  1503.                               Var PlayEnd        : TFSM      ) : TError;
  1504.  
  1505. BEGIN
  1506.  
  1507.   Case Handle^.DriveInfo[Drive].Method Of
  1508.  
  1509.     {----}
  1510.  
  1511.     cCDMethodMSCDEX:
  1512.     BEGIN
  1513.  
  1514.        VCD_GetAudioStatusInfo := MSCDEX_GetAudioStatusInfo (
  1515.                                    Handle^.DriveInfo[Drive].MethodUnit,
  1516.                                    AudioStatus,
  1517.                                    Longint(PlayStart),
  1518.                                    Longint(PlayEnd)                      );
  1519.  
  1520.     END; { cCDMethodMSCDEX }
  1521.  
  1522.   END; { Case Handle^.DriveInfo[Drive].Method }
  1523.  
  1524. END;  { VCD_GetAudioStatusInfo }
  1525.  
  1526. {────────────────────────────────────────────────────────────────────────────}
  1527.  
  1528. (*-
  1529.  
  1530. [FUNCTION]
  1531.  
  1532. Function  VCD_PlayMSFfor(         Handle         : TCDHandle;
  1533.                                   Drive          : WORD;
  1534.                                   Start          : TFSM;
  1535.                                   PlayFor        : TFSM      ) : TError;
  1536.  
  1537. [PARAMETERS]
  1538.  
  1539. Handle      ?
  1540. Drive       CD-ROM Drive Number
  1541. Start       Min/Sec/Frame to Start Playing From
  1542. PlayFor     Number of Min/Sec/Frame to Play
  1543.  
  1544. [RETURNS]
  1545.  
  1546. [DESCRIPTION]
  1547.  
  1548. Plays from a specified min/sec/frame for a specified number  of
  1549. mins/secs/frames.
  1550.  
  1551. [SEE-ALSO]
  1552.  
  1553. [EXAMPLE]
  1554.  
  1555. -*)
  1556.  
  1557. Function  VCD_PlayMSFfor(         Handle         : TCDHandle;
  1558.                                   Drive          : WORD;
  1559.                                   Start          : TFSM;
  1560.                                   PlayFor        : TFSM      ) : TError;
  1561.  
  1562. Var
  1563.    L      : LONGINT;
  1564.  
  1565. BEGIN
  1566.  
  1567.   Case Handle^.DriveInfo[Drive].Method Of
  1568.  
  1569.     {----}
  1570.  
  1571.     cCDMethodMSCDEX:
  1572.     BEGIN
  1573.  
  1574.        L := VCD_MSFtoTotalFrames ( PlayFor );
  1575.  
  1576.        VCD_PlayMSFfor := MSCDEX_PlayAudio (
  1577.                            Handle^.DriveInfo[Drive].MethodUnit,
  1578.                            cMscdexMSFMode,
  1579.                            Longint(Start),
  1580.                            L                                   );
  1581.  
  1582.     END; { cCDMethodMSCDEX }
  1583.  
  1584.     {----}
  1585.  
  1586.   END; { Case Handle^.DriveInfo[Drive].Method }
  1587.  
  1588. END; { VCD_PlayMSFfor }
  1589.  
  1590. {────────────────────────────────────────────────────────────────────────────}
  1591.  
  1592. (*-
  1593.  
  1594. [FUNCTION]
  1595.  
  1596. Function  VCD_PlayMSFto(          Handle         : TCDHandle;
  1597.                                   Drive          : WORD;
  1598.                                   Start          : TFSM;
  1599.                                   PlayTo         : TFSM      ) : TError;
  1600.  
  1601. [PARAMETERS]
  1602.  
  1603. Handle      ?
  1604. Drive       CD-ROM Drive Number
  1605. Start       Min/Sec/Frame to Start Playing from
  1606. PlayTo      Min/Sec/Frame to End Playing at
  1607.  
  1608. [RETURNS]
  1609.  
  1610. [DESCRIPTION]
  1611.  
  1612. Plays from a specified min/sec/frame to a specified min/sec/frame.
  1613.  
  1614. [SEE-ALSO]
  1615.  
  1616. [EXAMPLE]
  1617.  
  1618. -*)
  1619.  
  1620. Function  VCD_PlayMSFto(          Handle         : TCDHandle;
  1621.                                   Drive          : WORD;
  1622.                                   Start          : TFSM;
  1623.                                   PlayTo         : TFSM      ) : TError;
  1624.  
  1625. Var
  1626.   PlayFor : TFSM;
  1627.  
  1628. BEGIN
  1629.  
  1630.   VCD_SubMSF( PlayTo, Start, PlayFor );
  1631.   VCD_PlayMSFto := VCD_PlayMSFfor( Handle, Drive, Start, PlayFor );
  1632.  
  1633. END; { VCD_PlayMSFto }
  1634.  
  1635. {────────────────────────────────────────────────────────────────────────────}
  1636.  
  1637. (*-
  1638.  
  1639. [FUNCTION]
  1640.  
  1641. Function VCD_Pause(               Handle         : TCDHandle;
  1642.                                   Drive          : WORD      ) : TError;
  1643.  
  1644. [PARAMETERS]
  1645.  
  1646. Handle      ?
  1647. Drive       CD-ROM Drive Number
  1648.  
  1649. [RETURNS]
  1650.  
  1651. [DESCRIPTION]
  1652.  
  1653. Pauses the audio play of a specified drive.
  1654.  
  1655. [SEE-ALSO]
  1656.  
  1657. [EXAMPLE]
  1658.  
  1659. -*)
  1660.  
  1661. Function VCD_Pause(               Handle         : TCDHandle;
  1662.                                   Drive          : WORD      ) : TError;
  1663.  
  1664. BEGIN
  1665.  
  1666.   Case Handle^.DriveInfo[Drive].Method Of
  1667.  
  1668.     {----}
  1669.  
  1670.     cCDMethodMSCDEX:
  1671.     BEGIN
  1672.  
  1673.        VCD_Pause := MSCDEX_StopAudio( Handle^.DriveInfo[Drive].MethodUnit );
  1674.  
  1675.     END; { cCDMethodMSCDEX }
  1676.  
  1677.     {----}
  1678.  
  1679.   END; { Case Handle^.DriveInfo[Drive].Method }
  1680.  
  1681. END; { VCD_Pause }
  1682.  
  1683. {────────────────────────────────────────────────────────────────────────────}
  1684.  
  1685. (*-
  1686.  
  1687. [FUNCTION]
  1688.  
  1689. Function  VCD_Stop(               Handle         : TCDHandle;
  1690.                                   Drive          : WORD      ) : TError;
  1691.  
  1692. [PARAMETERS]
  1693.  
  1694. Handle      ?
  1695. Drive       CD-ROM Drive Number
  1696.  
  1697. [RETURNS]
  1698.  
  1699. [DESCRIPTION]
  1700.  
  1701. Stops the audio play of a specified drive.
  1702.  
  1703. [SEE-ALSO]
  1704.  
  1705. [EXAMPLE]
  1706.  
  1707. -*)
  1708.  
  1709. Function  VCD_Stop(               Handle         : TCDHandle;
  1710.                                   Drive          : WORD      ) : TError;
  1711.  
  1712. BEGIN
  1713.  
  1714.   Case Handle^.DriveInfo[Drive].Method Of
  1715.  
  1716.     {----}
  1717.  
  1718.     cCDMethodMSCDEX:
  1719.     BEGIN
  1720.  
  1721.        VCD_Stop := MSCDEX_StopAudio( Handle^.DriveInfo[Drive].MethodUnit );
  1722.        VCD_Stop := MSCDEX_StopAudio( Handle^.DriveInfo[Drive].MethodUnit );
  1723.  
  1724.     END; { cCDMethodMSCDEX }
  1725.  
  1726.     {----}
  1727.  
  1728.   END; { Case Handle^.DriveInfo[Drive].Method }
  1729.  
  1730. END; { VCD_Stop }
  1731.  
  1732. {────────────────────────────────────────────────────────────────────────────}
  1733.  
  1734. (*-
  1735.  
  1736. [FUNCTION]
  1737.  
  1738. Function  VCD_Resume(             Handle         : TCDHandle;
  1739.                                   Drive          : WORD      ) : TError;
  1740.  
  1741. [PARAMETERS]
  1742.  
  1743. Handle      ?
  1744. Drive       CD-ROM Drive Number
  1745.  
  1746. [RETURNS]
  1747.  
  1748. [DESCRIPTION]
  1749.  
  1750. Resumes the audio play of a specified drive.
  1751.  
  1752. [SEE-ALSO]
  1753.  
  1754. [EXAMPLE]
  1755.  
  1756. -*)
  1757.  
  1758. Function  VCD_Resume(             Handle         : TCDHandle;
  1759.                                   Drive          : WORD      ) : TError;
  1760.  
  1761. BEGIN
  1762.  
  1763.   Case Handle^.DriveInfo[Drive].Method Of
  1764.  
  1765.     {----}
  1766.  
  1767.     cCDMethodMSCDEX:
  1768.     BEGIN
  1769.  
  1770.        VCD_Resume := MSCDEX_ResumeAudio(Handle^.DriveInfo[Drive].MethodUnit);
  1771.  
  1772.     END; { cCDMethodMSCDEX }
  1773.  
  1774.     {----}
  1775.  
  1776.   END;  { Case Handle^.DriveInfo[Drive].Method }
  1777.  
  1778. END; { VCD_Resume }
  1779.  
  1780. {────────────────────────────────────────────────────────────────────────────}
  1781.  
  1782. (*-
  1783.  
  1784. [FUNCTION]
  1785.  
  1786. Function  VCD_PlayTracks(         Handle         : TCDHandle;
  1787.                                   Drive          : WORD;
  1788.                                   FirstTrack     : BYTE;
  1789.                                   NumTracks      : BYTE      ) : TError;
  1790.  
  1791. [PARAMETERS]
  1792.  
  1793. Handle      ?
  1794. Drive       CD-ROM Drive Number
  1795. FirstTrack  Audio track to start the play at
  1796. NumTracks   Number of audio tracks to play
  1797.  
  1798. [RETURNS]
  1799.  
  1800. [DESCRIPTION]
  1801.  
  1802. Plays the specified "numtracks" number of audio tracks, starting at
  1803. "firsttrack"
  1804.  
  1805. [SEE-ALSO]
  1806.  
  1807. [EXAMPLE]
  1808.  
  1809. -*)
  1810.  
  1811.  
  1812. Function  VCD_PlayTracks(         Handle         : TCDHandle;
  1813.                                   Drive          : WORD;
  1814.                                   FirstTrack     : BYTE;
  1815.                                   NumTracks      : BYTE      ) : TError;
  1816. BEGIN
  1817.  
  1818. END;
  1819.  
  1820. {────────────────────────────────────────────────────────────────────────────}
  1821.  
  1822. (*-
  1823.  
  1824. [FUNCTION]
  1825.  
  1826. Function  VCD_PlayNextTrack(      Handle         : TCDHandle;
  1827.                                   Drive          : WORD       ) : TError;
  1828.  
  1829. [PARAMETERS]
  1830.  
  1831. Handle      ?
  1832. Drive       CD-ROM Drive Number
  1833.  
  1834. [RETURNS]
  1835.  
  1836. [DESCRIPTION]
  1837.  
  1838. Skips forward to the track following the currently playing track.
  1839.  
  1840. [SEE-ALSO]
  1841.  
  1842. [EXAMPLE]
  1843.  
  1844. -*)
  1845.  
  1846.  
  1847. Function  VCD_PlayNextTrack(      Handle         : TCDHandle;
  1848.                                   Drive          : WORD       ) : TError;
  1849.  
  1850. VAR
  1851.    TrackNum       : BYTE;
  1852.    IndexNum       : BYTE;
  1853.    TrackTime      : tFSM;
  1854.    DiskTime       : tFSM;
  1855.    Start          : tFSM;
  1856.    TrackCon       : BYTE;
  1857.    ConAddr        : BYTE;
  1858.    StartTrack     : BYTE;
  1859.    EndTrack       : BYTE;
  1860.    LeadOut        : tFSM;
  1861.    Length         : tFSM;
  1862.    Status         : tError;
  1863. BEGIN
  1864.  
  1865.   Status := VCD_GetAudioDiskInfo  ( Handle, Drive, StartTrack, EndTrack, LeadOut );
  1866.  
  1867.   Status := VCD_GetAudioQChanInfo ( Handle, Drive, conaddr,tracknum,indexnum,tracktime,disktime);
  1868.  
  1869.   Inc(TrackNum);
  1870.   If TrackNum > EndTrack Then
  1871.      TrackNum := StartTrack;
  1872.  
  1873.   Status := VCD_GetAudioTrackInfo ( Handle, Drive, TrackNum, start, trackcon );
  1874.  
  1875.   VCD_SubMSF ( LeadOut, Start, Length );
  1876.  
  1877.   Status := VCD_stop( Handle, drive );
  1878.  
  1879.   Status := VCD_PlayMSFFor ( Handle, Drive , start, Length );
  1880.   VCD_PlayNextTrack := Status;
  1881.  
  1882. END;
  1883.  
  1884. {────────────────────────────────────────────────────────────────────────────}
  1885.  
  1886. (*-
  1887.  
  1888. [FUNCTION]
  1889.  
  1890. Function  VCD_PlayPrevTrack(      Handle         : TCDHandle;
  1891.                                   Drive          : WORD       ) : TError;
  1892.  
  1893. [PARAMETERS]
  1894.  
  1895. Handle      ?
  1896. Drive       CD-ROM Drive Number
  1897.  
  1898. [RETURNS]
  1899.  
  1900. [DESCRIPTION]
  1901.  
  1902. Plays the track prior to the currently playing audio track.
  1903.  
  1904. [SEE-ALSO]
  1905.  
  1906. [EXAMPLE]
  1907.  
  1908. -*)
  1909.  
  1910. Function  VCD_PlayPrevTrack(      Handle         : TCDHandle;
  1911.                                   Drive          : WORD       ) : TError;
  1912.  
  1913. VAR
  1914.    TrackNum       : BYTE;
  1915.    IndexNum       : BYTE;
  1916.    TrackTime      : tFSM;
  1917.    DiskTime       : tFSM;
  1918.    Start          : tFSM;
  1919.    TrackCon       : BYTE;
  1920.    ConAddr        : BYTE;
  1921.    StartTrack     : BYTE;
  1922.    EndTrack       : BYTE;
  1923.    LeadOut        : tFSM;
  1924.    Length         : tFSM;
  1925.    Status         : tError;
  1926.  
  1927. BEGIN
  1928.  
  1929.   Status := VCD_GetAudioDiskInfo  ( Handle, Drive, StartTrack, EndTrack, LeadOut );
  1930.  
  1931.   Status := VCD_GetAudioQChanInfo ( Handle, Drive, conaddr,tracknum,indexnum,tracktime,disktime);
  1932.  
  1933.   Dec(TrackNum);
  1934.   If TrackNum < StartTrack Then
  1935.      TrackNum := EndTrack;
  1936.  
  1937.   Status := VCD_GetAudioTrackInfo ( Handle, Drive, TrackNum, start, trackcon );
  1938.  
  1939.   VCD_SubMSF ( LeadOut, Start, Length );
  1940.  
  1941.   Status := VCD_stop( Handle, drive );
  1942.  
  1943.   Status := VCD_PlayMSFFor ( Handle, Drive , start, Length );
  1944.   VCD_PlayPrevTrack := Status;
  1945.  
  1946. END;
  1947.  
  1948. {────────────────────────────────────────────────────────────────────────────}
  1949.  
  1950. (*-
  1951.  
  1952. [FUNCTION]
  1953.  
  1954. Function  VCD_PlayForwardMSF(     Handle         : TCDHandle;
  1955.                                   Drive          : WORD;
  1956.                                   MoveForward    : TFSM       ) : TError;
  1957.  
  1958. [PARAMETERS]
  1959.  
  1960. Handle      ?
  1961. Drive       CD-ROM Drive Number
  1962.  
  1963. [RETURNS]
  1964.  
  1965. [DESCRIPTION]
  1966.  
  1967. Skips the current audio play forward by the specified Min:Sec.Frame
  1968. count.  Can be used to implement a "fast-forward" control.
  1969.  
  1970. [SEE-ALSO]
  1971.  
  1972. [EXAMPLE]
  1973.  
  1974. -*)
  1975.  
  1976.  
  1977. Function  VCD_PlayForwardMSF(     Handle         : TCDHandle;
  1978.                                   Drive          : WORD;
  1979.                                   MoveForward    : TFSM       ) : TError;
  1980. VAR
  1981.    TrackNum       : BYTE;
  1982.    IndexNum       : BYTE;
  1983.    TrackTime      : tFSM;
  1984.    DiskTime       : tFSM;
  1985.    Start          : tFSM;
  1986.    TrackCon       : BYTE;
  1987.    ConAddr        : BYTE;
  1988.    StartTrack     : BYTE;
  1989.    EndTrack       : BYTE;
  1990.    LeadOut        : tFSM;
  1991.    Length         : tFSM;
  1992.    TempMSF        : tFSM;
  1993.    Status         : tError;
  1994. BEGIN
  1995.  
  1996.   Status := VCD_GetAudioDiskInfo  ( Handle, Drive, StartTrack, EndTrack, LeadOut );
  1997.   Status := VCD_GetAudioQChanInfo ( Handle, Drive, conaddr,tracknum,indexnum,tracktime,disktime);
  1998.  
  1999.   VCD_AddMSF ( DiskTime,MoveForward ,TempMSF );
  2000.  
  2001.   If VCD_MSFToTotalFrames(TempMSF) <= VCD_MSFToTotalFrames(Leadout) Then
  2002.   Begin
  2003.      VCD_SubMSF ( Leadout, TempMSF, Length );
  2004.      Status := VCD_PlayMSFFor ( Handle, Drive , TempMSF, Length );
  2005.   End
  2006.   else
  2007.   Begin
  2008.      Status := VCD_GetAudioTrackInfo ( Handle, Drive, 1, start, trackcon );
  2009.      VCD_SubMSF(LeadOut,Start,Length);
  2010.      VCD_PlayMSFFor( Handle,Drive,Start,Length);
  2011.   End;
  2012.  
  2013.   VCD_PlayForwardMSF := Status;
  2014.  
  2015. END;
  2016.  
  2017. {────────────────────────────────────────────────────────────────────────────}
  2018.  
  2019.  
  2020. (*-
  2021.  
  2022. [FUNCTION]
  2023.  
  2024. Function  VCD_PlayForwardLBA(     Handle         : TCDHandle;
  2025.                                   Drive          : WORD;
  2026.                                   MoveForward    : LONGINT    ) : TError;
  2027.  
  2028. [PARAMETERS]
  2029.  
  2030. Handle      ?
  2031. Drive       CD-ROM Drive Number
  2032.  
  2033. [RETURNS]
  2034.  
  2035. [DESCRIPTION]
  2036.  
  2037. Skips the current audio play forward by the specified number of blocks.
  2038. Can be used to implement a "fast-forward" control.
  2039.  
  2040. [SEE-ALSO]
  2041.  
  2042. [EXAMPLE]
  2043.  
  2044. -*)
  2045.  
  2046.  
  2047. Function  VCD_PlayForwardLBA(     Handle         : TCDHandle;
  2048.                                   Drive          : WORD;
  2049.                                   MoveForward    : LONGINT    ) : TError;
  2050.  
  2051. Begin
  2052. END;
  2053.  
  2054. {────────────────────────────────────────────────────────────────────────────}
  2055.  
  2056. (*-
  2057.  
  2058. [FUNCTION]
  2059.  
  2060. Function  VCD_PlayReverseMSF(     Handle         : TCDHandle;
  2061.                                   Drive          : WORD;
  2062.                                   MoveReverse    : TFSM       ) : TError;
  2063.  
  2064. [PARAMETERS]
  2065.  
  2066. Handle      ?
  2067. Drive       CD-ROM Drive Number
  2068.  
  2069. [RETURNS]
  2070.  
  2071. [DESCRIPTION]
  2072.  
  2073. Skips the current audio play backward by the specified Min:Sec.Frame
  2074. count.  Can be used to implement a "fast-rewind" control.
  2075.  
  2076. [SEE-ALSO]
  2077.  
  2078. [EXAMPLE]
  2079.  
  2080. -*)
  2081.  
  2082.  
  2083. Function  VCD_PlayReverseMSF(     Handle         : TCDHandle;
  2084.                                   Drive          : WORD;
  2085.                                   MoveReverse    : TFSM       ) : TError;
  2086. VAR
  2087.    TrackNum       : BYTE;
  2088.    IndexNum       : BYTE;
  2089.    TrackTime      : tFSM;
  2090.    DiskTime       : tFSM;
  2091.    Start          : tFSM;
  2092.    TrackCon       : BYTE;
  2093.    ConAddr        : BYTE;
  2094.    StartTrack     : BYTE;
  2095.    EndTrack       : BYTE;
  2096.    LeadOut        : tFSM;
  2097.    Length         : tFSM;
  2098.    TempMSF        : tFSM;
  2099.    Status         : tError;
  2100. BEGIN
  2101.  
  2102.   Status := VCD_GetAudioDiskInfo  ( Handle, Drive, StartTrack, EndTrack, LeadOut );
  2103.   Status := VCD_GetAudioQChanInfo ( Handle, Drive, conaddr,tracknum,indexnum,tracktime,disktime);
  2104.   Status := VCD_GetAudioTrackInfo ( Handle, Drive, 1, Start, TrackCon );
  2105.  
  2106.   If VCD_MSFToTotalFrames(DiskTime) > VCD_MSFToTotalFrames(MoveReverse) Then
  2107.   Begin
  2108.      VCD_SubMSF ( DiskTime,MoveReverse ,TempMSF );
  2109.      VCD_SubMSF ( Leadout, TempMSF, Length );
  2110.      Status := VCD_PlayMSFFor ( Handle, Drive , TempMSF, Length );
  2111.   End
  2112.   Else
  2113.   Begin
  2114.      Status := VCD_GetAudioTrackInfo ( Handle, Drive, EndTrack, start, trackcon );
  2115.      VCD_SubMSF(Leadout,MoveReverse,TempMSF);
  2116.      VCD_SubMSF(LeadOut,TempMSF,Length);
  2117.      VCD_PlayMSFFor( Handle,Drive,TempMSF,Length);
  2118.   End;
  2119.  
  2120.   VCD_PlayReverseMSF := Status;
  2121.  
  2122. END;
  2123.  
  2124. {────────────────────────────────────────────────────────────────────────────}
  2125.  
  2126.  
  2127. (*-
  2128.  
  2129. [FUNCTION]
  2130.  
  2131. Function  VCD_PlayReverseLBA(     Handle         : TCDHandle;
  2132.                                   Drive          : WORD;
  2133.                                   MoveReverse    : LONGINT    ) : TError;
  2134.  
  2135. [PARAMETERS]
  2136.  
  2137. Handle      ?
  2138. Drive       CD-ROM Drive Number
  2139.  
  2140. [RETURNS]
  2141.  
  2142. [DESCRIPTION]
  2143.  
  2144. Skips the current audio play backward by the specified # of logical blocks.
  2145. Can be used to implement a "fast-rewind" control.
  2146.  
  2147. [SEE-ALSO]
  2148.  
  2149. [EXAMPLE]
  2150.  
  2151. -*)
  2152.  
  2153.  
  2154. Function  VCD_PlayReverseLBA(     Handle         : TCDHandle;
  2155.                                   Drive          : WORD;
  2156.                                   MoveReverse    : LONGINT    ) : TError;
  2157.  
  2158. BEGIN
  2159.  
  2160. END;
  2161.  
  2162. {────────────────────────────────────────────────────────────────────────────}
  2163. {────────────────────────────────────────────────────────────────────────────}
  2164.  
  2165. BEGIN
  2166.  
  2167. END.
  2168.